class Solution {
    public void sortColors(int[] nums) {
        int left = -1, right = nums.length;
        int i = 0;
        while (i < right) {
            if (nums[i] == 0) {
                swap(nums, ++left, i++);
            }else if (nums[i] == 1) {
                i++;
            }else if (nums[i] == 2) {
                swap(nums, --right, i);
            }
        }
    }
    public void swap(int[] nums, int a, int b) {
        int t = nums[a];
        nums[a] = nums[b];
        nums[b] = t;
    }


    public static void main(String[] args) {
        Solution solution = new Solution();
        System.out.println("hello");
    }
}